package com.hb.common.service;

import com.hb.common.dto.Database;
import com.hb.common.dto.DbBackupFile;
import com.hb.common.exception.DbBackupException;
import com.hb.common.util.Result;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

public interface DbBackupFileService {

    /**
     * 根据数据库id，获取备份文件
     */
    Result<List<DbBackupFile>> selectBackupFiles(Integer id) throws DbBackupException;

    /**
     * 获取备份文件数量
     */
    Result<Integer> selectCount(Database database) throws DbBackupException;

    /**
     * 删除备份文件
     */
    Result<Boolean> deleteFile(Integer id, String fileName);

    /**
     * 下载备份文件
     *
     * @param fileName 备份文件名称
     * @param response response
     */
    void downloadFile(Integer id, String fileName, HttpServletResponse response) throws DbBackupException;

    /**
     * 上传数据库程序
     */
    Result<Boolean> uploadDbProgram(MultipartFile file);
}
